<template>
    <el-card class="product-card">
        <el-image :src="productInformation.imageUrl" fit="cover" class="product-image"></el-image>
        <div class="product-info">
            <h4 class="product-name">{{ productInformation.productName }}</h4>
            <p class="product-description">{{ productInformation.productDescription }}</p>
            <span class="product-price">¥{{ productInformation.price }}</span>
        </div>
    </el-card>
</template>

<script setup lang="ts">
import { defineProps } from 'vue';

interface ProductInfo {
    imageUrl: string;
    productName: string;
    productDescription: string;
    price: number;
}

defineProps<{
    productInformation: ProductInfo
}>();
</script>

<style scoped>
.product-card {
    width: 220px;
    margin: 10px;
    text-align: center;
}

.product-image {
    width: 180px;
    height: 180px;
}

.product-info {
    padding: 14px;
}

.product-name {
    font-size: 16px;
    margin: 10px 0;
}

.product-description {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 18px;
    color: #ff6700;
    font-weight: bold;
}
</style>